package com.tancire.web.controller.client.member;

import com.tancire.common.annotation.Client;
import com.tancire.common.core.controller.BaseController;
import com.tancire.common.core.domain.AjaxResult;
import com.tancire.common.enums.UserSource;
import com.tancire.member.domain.Member;
import com.tancire.member.service.IMemberService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 会员管理Controller
 *
 * @author tancire
 * @date 2024-05-20
 */
@RestController
@RequestMapping("/client/member")
public class MemberClientController extends BaseController {

    @Resource
    private IMemberService memberService;

    /**
     * 获取会员管理详细信息
     */
    @Client(UserSource.MEMBER)
    @GetMapping(value = "/info")
    public AjaxResult getInfo() {
        return AjaxResult.success(memberService.selectMemberByMemberInfo());
    }

    /**
     * 获取会员管理详细信息
     */
    @Client(UserSource.MEMBER)
    @PostMapping(value = "/update")
    public AjaxResult updateMemberInfo(@RequestBody Member member) {
        memberService.updateMemberInfo(member);
        return AjaxResult.success("修改成功");
    }

}
